package com.atguigu.hellomp.test;

import io.minio.BucketExistsArgs;
import io.minio.MinioClient;
import io.minio.UploadObjectArgs;
import io.minio.errors.*;

import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public class T2 {
    public static void main(String[] args) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
        MinioClient minioClient = MinioClient.builder()
                .endpoint("http://192.168.45.100:9000")
                .credentials("minioadmin", "minioadmin")
                .build();

        BucketExistsArgs bucketExistsArgs = BucketExistsArgs.builder()
                .bucket("lease")
                .build();
       boolean b= minioClient.bucketExists(bucketExistsArgs);
        System.out.println(b);

        UploadObjectArgs uploadObjectArgs = UploadObjectArgs.builder()
                .bucket("lease")
                .filename("d:/2.jpg")
                .object("2.jpg")
                .build();
        minioClient.uploadObject(uploadObjectArgs);



    }
}
